<?php
class Staticizer_Index_Data extends Staticizer
{
    public function Build($param=NULL)
    {
        #获取数据
        $data=DB::GetRows('select ID,Title,Content,M_HTMLFile,Datetime from News where ClassID='.DAO_NewsClass::DATA_ID.' and M_IsDelete=FALSE order by M_IsTop desc,M_IsTop_Datetime desc,Datetime desc limit 0,8');

        #处理数据
        foreach($data as &$row)
        {
            $row['M_HTMLFile']=Config::PATH_RELATIVE_CONTENT_NEWS.'/'.$row['M_HTMLFile'];
            if((time()-strtotime($row['Datetime']))/3600/24<3)
                $row['IsNew']='TRUE';
            else
                $row['IsNew']='FALSE';
        }

        #绑定数据
        View::Assign('News',$data);

        #生成静态
        $this->Save('index/news.data.html',View::Fetch('index/news.data.tpl'));
    }
}
?>